package  com.bonc.common.security.dao;

import com.bonc.common.security.entity.UiResource;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

/**
 * UiResource的DAO
 * @author song手工写
 */
public interface UiResourceDao2 extends JpaRepository<UiResource, Long>,JpaSpecificationExecutor<UiResource> {
    
       /**
     * 返回来有权限的ui资源
     * @return 
     */
    @Query(" select  m from SysUser u  left join  u.roles r  left join   r.resources  m   where  m in ( from UiResource )  and u.loginId = ?1 ")
       public List<UiResource>  getAccessedUiResource(String loginId);
    
}
